extends mixins/_layout

block content
  body
    #wrapper
      //- 顶部导航
      include mixins/_header
      +header(navigator, 'editor')
      
      //- editor
      #editor
        textarea#editorArea

      include mixins/_post
      +post
      
      include mixins/_footer
      +footer

    script(src='/ckeditor/ckeditor.js')
    script(src="/js/laydate" +config.min + ".js")
    include mixins/_footer_js
    +footerjs(config)
    script.
      window.addEventListener('DOMContentLoaded',function(){
        //初始化CKEditor编辑器
        CKEDITOR.replace('editorArea');
        //提交表单
        kblog.postArticle({
          'html' : true
        });

        var dateInput=$('#date'), time = new Date(), year = time.getFullYear(), month = time.getMonth()+1, date = time.getDate();
        month = month<10? ('0'+month) : month;
        date = date<10? ('0'+date) : date;
        dateInput.value=year + '-' + month + '-' + date;

        // 防止误操作页面刷新/关闭
        window.onbeforeunload=function(){
          //return false;
        }

      });
      